public class Fibonaccisequence {
    public static  int fib(int n){
        if(n == 1|| n==2) return 1;
        int f1 = 1;
        int f2 = 1;
        int f3 = 0;
        for(int i =2;i<n;i++){
            f3 =f1+f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;
    }
    public static  void main(String[] args){
         int ret = fib(1);
         int ret2 = fib(3);
         int ret3 = fib(6);
         System.out.println(ret);
         System.out.println(ret2);
         System.out.println(ret3);
    }
}
